-
Notifications
You must be signed in to change notification settings - Fork 55
[WC-3050] Retrieve pdfjs worker locally instead of cdn #1817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
03e05ee
to
2f12295
Compare
7908040
to
2bddeee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
27561ca
to
6d4485d
Compare
e7af5a5
to
c05c050
Compare
c05c050
to
3c1a7c7
Compare
3c1a7c7
to
a69bc3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Document Viewer widget to bundle PDF.js worker files locally instead of loading them from a CDN, improving Content Security Policy (CSP) compliance. The changes involve downgrading the pdfjs-dist dependency to maintain compatibility with react-pdf.
- Configures Rollup to copy PDF.js worker files, cmaps, and standard fonts to the local build
- Updates PDF.js worker URL configuration to use local paths instead of CDN URLs
- Downgrades pdfjs-dist from version 5.0.375 to 4.8.69 for react-pdf compatibility
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
rollup.config.mjs | Adds copy plugin to bundle PDF.js worker files and dependencies locally |
package.json | Bumps version to 1.1.0 and downgrades pdfjs-dist to 4.8.69 for compatibility |
PDFViewer.tsx | Updates worker and resource URLs to use local paths instead of CDN |
CHANGELOG.md | Documents the change to local PDF.js worker bundling |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
a69bc3e
to
3c4fbde
Compare
3c4fbde
to
cdfa90f
Compare
Pull request type
Description
pdfjs-dist version has to be the same with react-pdf dependency
https://github.com/wojtekmaj/react-pdf/blob/5e0d135f5d1d3a3cec4628a2fc05a4a8f0bed9e7/packages/react-pdf/package.json#L60
this version use "4.8.69"